<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">
    <title>酒店资讯</title>
    <link href="css/admin/common.css" type="text/css" rel="stylesheet">
    <style type="text/css">
        table{
            text-align: center;
            border-collapse: collapse;
        }
        .bgcolor{
            background-color: #F08080;
        }
    </style>
    <script type="text/javascript">
        function changeColor(obj){
            obj.className = "bgcolor";
        }
        function changeColor1(obj){
            obj.className = "";
        }
    </script>
</head>
<body>
<c:if test="${allRooms.size() == 0 }">
    您还没有资讯。
</c:if>
<c:if test="${allRooms.size() != 0 }">
    <div >
    <table border="1" bordercolor="PaleGreen" style="margin-left: 170px">
        <tr>
            <th width="50px">资讯编号</th>
            <th width="200px">资讯标题</th>
            <th width="100px">时间</th>
            <th width="100px">操作</th>
        </tr>
        <c:forEach items="${notice}" var="notice">
            <tr onmousemove="changeColor(this)" onmouseout="changeColor1(this)">
                <td>${notice.noticeId}</td>
                <td>${notice.noticeTitle}</td>
                <td>${notice.noticeTime}</td>
                <td><a href="/admin/notice/selectANotice?noticeId=${notice.noticeId}" target="_blank">详情</a>
                    <a href="/admin/notice/toUpdateANotice?noticeId=${notice.noticeId}&flag=update" target="center" >修改</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="4" align="right">
                &nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;共${totalCount}条记录&nbsp;&nbsp;共${totalPage}页&nbsp;&nbsp;
                第${pageCur}页&nbsp;&nbsp;
                <c:url var="url_pre" value="/admin/room/selectAllRooms">
                    <c:param name="pageCur" value="${pageCur - 1 }"/>
                </c:url>
                <c:url var="url_next" value="/admin/room/selectAllRooms">
                    <c:param name="pageCur" value="${pageCur + 1 }"/>
                </c:url>
                <!-- 第一页没有上一页 -->
                <c:if test="${pageCur != 1 }">
                    <a href="${url_pre}">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
                </c:if>
                <!-- 最后一页，没有下一页 -->
                <c:if test="${pageCur != totalPage && totalPage != 0}">
                    <a href="${url_next}">下一页</a>
                </c:if>
            </td>
        </tr>
    </table>
    </div>
</c:if>
${message}
</body>
</html>